home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / pgm_ctrl / vbswit / vbswitch.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-11  |  2.4 KB  |  69 lines

  1. VERSION 2.00
  2. Begin Form frmNoSwitch 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "No Task Switching"
  5.    ClientHeight    =   1170
  6.    ClientLeft      =   1800
  7.    ClientTop       =   1965
  8.    ClientWidth     =   3345
  9.    Height          =   1575
  10.    Icon            =   VBSWITCH.FRX:0000
  11.    Left            =   1740
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   1170
  16.    ScaleWidth      =   3345
  17.    Top             =   1620
  18.    Width           =   3465
  19.    Begin ccWinHook sbcWinHook 
  20.       Left            =   270
  21.       Messages        =   VBSWITCH.FRX:0302
  22.       Monitor         =   6  'Systemwide
  23.       Top             =   330
  24.    End
  25. Option Explicit
  26. ' Copyright 
  27.  1994 by Computer Technologies, Inc. All rights reserved.
  28. Sub Form_Resize ()
  29. ' Copyright 
  30.  1994 by Computer Technologies, Inc. All rights reserved.
  31. ' This line forces the application to remain an icon
  32. ' no matter what happens.
  33.     If Me.WindowState <> 1 Then Me.WindowState = 1
  34. End Sub
  35. Sub sbcWinHook_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, nodef As Integer)
  36. ' Copyright 
  37.  1994 by Computer Technologies, Inc. All rights reserved.
  38.     Static bAltDown         As Integer
  39.     Dim bEatMessage         As Integer
  40.     bEatMessage = False
  41. ' Evaluate the type of message. The hook control is setup to
  42. ' only pass us the four messages listed here and no others.
  43.     Select Case msg
  44.     Case WM_SYSCOMMAND
  45.         If wp = SC_TASKLIST Then bEatMessage = True     ' Eat CTRL-ESC
  46.         If wnd = Me.hWnd And wp = IDM_ABOUT Then        ' About menu choice clicked
  47.         Call APP_About
  48.         End If
  49.     Case WM_SYSKEYDOWN               ' For this msg type wp = keycode
  50.         Select Case wp
  51.         Case KEY_ALT
  52.             bAltDown = True                         ' Track state of ALT key
  53.         Case KEY_TAB
  54.             If bAltDown = True Then
  55.             bEatMessage = True                  ' Eat ALT-TAB
  56.             End If
  57.         End Select
  58.     Case WM_SYSKEYUP                ' For this msg type wp = keycode
  59.         If wp = KEY_ALT Then bAltDown = False           ' Track state of ALT key
  60.     Case WM_LBUTTONDBLCLK
  61.         If wnd = gnDesktopHwnd Then bEatMessage = True  ' Double click on desktop
  62.     End Select
  63. ' This code 'eats' or removes the message from the system.
  64.     If bEatMessage = True Then
  65.     nodef = True
  66.     msg = 0
  67.     End If
  68. End Sub
  69.